package fuction;

import java.util.ArrayList;

public class testDemo5 {
    public static void main(String[] args) {
        ArrayList<User> users = new ArrayList<>();
        users.add(new User(1,"heiman",20));
        users.add(new User(2,"A1",30));
        users.add(new User(3,"2",50));
        users.add(new User(4,"3",60));
        users.add(new User(5,"5",16));

        System.out.println(users.stream().filter((user) -> {
            if (user.getId() % 2 == 0 && user.getAge() > 23) {
                return true;
            }else{
                return false;
            }
        }).map((user) -> {
            StringBuffer upperCase = new StringBuffer(user.getName().toUpperCase());
            user.setName(upperCase.reverse().toString());
            return user;
        }).toList().get(0));
    }
}
